﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Common
{
    public class RegionStateManager
    {
        #region Login process
        public static LoginState LoginStateForm;
        public static event StateChangeHandle<LoginState> LoginStateChangeHandle;
        public static void LoginStateChange(LoginState to)
        {
            Log.Debug("LoginStateChange:" + LoginStateForm + " to " + to);
            if (LoginStateChangeHandle != null) LoginStateChangeHandle(LoginStateForm, to);
            LoginStateForm = to;
        }
        #endregion

    }

    public delegate void StateChangeHandle<T>(T from, T to);
    [Flags]
    public enum LoginState
    {
        None = 0,
        LoginBegin,
        LoginError,
        LoginEnd,
        LogoutBegin,
        LogoutEnd,
    }
}